package com.zj.HJ;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class HJ27 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String num = sc.nextLine();
        getRes(num);
    }

    public static void getRes(String num) {
        String[] arr = num.split(" ");
        String key = arr[arr.length - 2];
        int seq = Integer.parseInt(arr[arr.length - 1]);
        List<String> list = new ArrayList<>();
        for (int i = 1; i < arr.length - 2; i++) {
            if (arr[i].length() == key.length() && !arr[i].equals(key)) {
                list.add(arr[i]);
            }
        }
        list.sort((a, b) -> a.compareTo(b));
        System.out.println(list.size());
        if (seq <= list.size()) {
            System.out.println(list.get(seq - 1));
        }
    }

    public static boolean isBrother(String str1, String str2) {
        char[] chars1 = str1.toCharArray();
        char[] chars2 = str2.toCharArray();
        Arrays.sort(chars1);
        Arrays.sort(chars2);
        for (int i = 0; i < chars1.length; i++) {
            if (chars1[i] != chars2[2]) {
                return false;
            }
        }
        return true;
    }
}
